package com.example.crm.web.filter;

import com.example.crm.web.config.AuthorizationInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class InterceptorConfig implements WebMvcConfigurer {
    public String [] excludePathPatterns;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String [] pathPatterns={"/**"};  //拦截路劲规则
        String [] excludePatterns={"/login","/regist","/statics/**"};   //排除路劲规则
        registry.addInterceptor(new AuthorizationInterceptor())     //注册拦截
                .addPathPatterns(pathPatterns)      //添加路劲规则
                .excludePathPatterns(excludePatterns);      //添加排除路劲规则
    }
}
